home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / PC Card Manager / CIncludes / TextObjects.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-25  |  7.4 KB  |  208 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        TextObjects.h
  3.  
  4.      Contains:    Text object Interfaces.
  5.  
  6.      Version:    System 8
  7.  
  8.      DRI:        Andrew Daniels
  9.  
  10.      Copyright:    © 1984-1996 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Warning:    *** APPLE INTERNAL USE ONLY ***
  14.                  This file may contain unreleased API's
  15.  
  16.      BuildInfo:    Built by:            SuperMario Build Daemon
  17.                  With Interfacer:    2.0d11   (PowerPC native)
  18.                  From:                TextObjects.i
  19.                      Revision:        29
  20.                      Dated:            3/5/96
  21.                      Last change by:    AMD
  22.                      Last comment:    Some binary and source-compatible cosmetic changes -- call
  23.  
  24.      Bugs:        Report bugs to Radar component “System Interfaces”, “Latest”
  25.                  List the version information (from above) in the Problem Description.
  26.  
  27. */
  28. #ifndef __TEXTOBJECTS__
  29. #define __TEXTOBJECTS__
  30.  
  31. #ifndef __CONDITIONALMACROS__
  32. #include <ConditionalMacros.h>
  33. #endif
  34. #ifndef __TYPES__
  35. #include <Types.h>
  36. #endif
  37. #ifndef __UNICODE__
  38. #include <Unicode.h>
  39. #endif
  40. #ifndef __TEXTCOMMON__
  41. #include <TextCommon.h>
  42. #endif
  43.  
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47.  
  48. #if PRAGMA_IMPORT_SUPPORTED
  49. #pragma import on
  50. #endif
  51.  
  52. #if PRAGMA_ALIGN_SUPPORTED
  53. #pragma options align=mac68k
  54. #endif
  55.  
  56. #if FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
  57. /* Basic data types */
  58. typedef UInt32 TextObjectUnit;
  59. typedef TextObjectUnit *TextObject;
  60. typedef TextObject *TextObjectPtr;
  61. typedef const TextObjectUnit *ConstTextObject;
  62. /* Indices into text objects */
  63. typedef UInt32 TextObjectIndex;
  64.  
  65. enum {
  66.     kTextObjectStart            = 0L,
  67.     kTextObjectEnd                = 0xFFFFFFFF
  68. };
  69.  
  70. /* Option flags */
  71. typedef OptionBits TextObjectOptions;
  72. /*
  73.  The default or standard OptionBits are all zero by convention. The following
  74.    symbolic constant is provided for code readability. 
  75. */
  76.  
  77. enum {
  78.     kTextObjStandardOptions        = 0
  79. };
  80.  
  81.  
  82. enum {
  83.     kTextObjNormalizeOptBit        = 0
  84. };
  85.  
  86.  
  87. enum {
  88.     kTextObjDontNormalizeOpt    = 0 << kTextObjNormalizeOptBit,
  89.     kTextObjNormalizeOpt        = 1 << kTextObjNormalizeOptBit
  90. };
  91.  
  92. /* Creation and destruction */
  93. extern OSStatus NewTextObject(TextObject *newTextObject);
  94.  
  95. extern OSStatus InitPersistentTextObject(TextObjectUnit textObjectSpace[], ByteCount sizeInBytes);
  96.  
  97. extern OSStatus DisposeTextObject(TextObject textObject);
  98.  
  99. extern OSStatus CreateTextObjectFromTextObject(ConstTextObject oldTextObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObject *newTextObject, TextObjectOptions optionBits);
  100.  
  101. /* Text content manipulation */
  102. extern OSStatus InstallTextIntoTextObject(const char *srcText, ByteCount srcLengthInBytes, TextEncoding srcEncoding, LocaleIdentifier language, TextObject destTextObject, TextObjectOptions optionBits);
  103.  
  104. extern OSStatus AppendTextToTextObject(const char *srcText, ByteCount srcLengthInBytes, TextEncoding srcEncoding, LocaleIdentifier language, TextObject destTextObject, TextObjectOptions optionBits);
  105.  
  106. extern OSStatus ExtractTextFromTextObject(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, char *destText, ByteCount destMaxSizeInBytes, TextEncoding destEncoding, LocaleIdentifier *language, ByteCount *destSizeInBytes, TextObjectIndex *nextSrcIndex);
  107.  
  108. extern OSStatus ReplaceInTextObject(TextObject destText, TextObjectIndex destStartIndex, TextObjectIndex destEndIndex, ConstTextObject srcText, TextObjectIndex srcStartIndex, TextObjectIndex srcEndIndex, TextObjectIndex *newStartIndex, TextObjectIndex *newEndIndex);
  109.  
  110. /* Text object information */
  111. extern Boolean IsPersistentTextObject(ConstTextObject textObject);
  112.  
  113. extern Boolean IsTextObjectEmpty(ConstTextObject textObject);
  114.  
  115. extern ByteCount GetTextObjectSize(ConstTextObject textObject);
  116.  
  117. extern ByteCount GetTextObjectMaxSize(ConstTextObject textObject);
  118.  
  119. extern TextObjectIndex GetTextObjectEndIndex(ConstTextObject textObject);
  120.  
  121. extern ByteCount ComputePersistentTextObjectSize(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObjectOptions optionBits);
  122.  
  123. extern ByteCount ComputePersistentTextObjectFromTextSize(const char *text, ByteCount textByteLength, TextEncoding textEncoding, LocaleIdentifier language, TextObjectOptions optionBits);
  124.  
  125. extern OSStatus ComputeTextObjectExtractedTextSize(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, ByteCount destMaxSizeInBytes, TextEncoding destEncoding, LocaleIdentifier *language, ByteCount *destResultLengthInBytes, TextObjectIndex *nextSrcIndex);
  126.  
  127. extern OSStatus GetTextObjectTextTags(ConstTextObject textObject, TextObjectIndex index, TextEncoding *encoding, LocaleIdentifier *language);
  128.  
  129. /* This is equivalent to the preceding function. The preceding name is preferred. */
  130. extern OSStatus GetTextObjectEncodingAndLocaleIdentifier(ConstTextObject textObject, TextObjectIndex index, TextEncoding *encoding, LocaleIdentifier *language);
  131.  
  132. /* Bulk access to text content */
  133. struct TextObjectTextInfo {
  134.     TextEncoding                     encoding;
  135.     LocaleIdentifier                 language;
  136.     TextObjectIndex                 startIndex;
  137.     TextObjectIndex                 endIndex;
  138.     ByteCount                         textLength;
  139.     const char *                    text;
  140. };
  141. typedef struct TextObjectTextInfo TextObjectTextInfo;
  142.  
  143. extern OSStatus CountTextObjectTextRuns(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, ItemCount *numTextRuns);
  144.  
  145. extern OSStatus GetTextObjectTextRuns(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, ItemCount runArraySize, TextObjectTextInfo runInfo[], ItemCount *actualNumTextRuns);
  146.  
  147. /* Comparison functions are in TextUtils */
  148. /* Annotations */
  149. /* Annotation types are given by the traditional four-character codes */
  150. typedef FourCharCode TextObjectAnnotationTag;
  151. /* A wildcard tag to specify all annotations */
  152.  
  153. enum {
  154.     kTextObjAnyAnnotationType    = '****'
  155. };
  156.  
  157. /* Annotation attributes */
  158. typedef OptionBits TextObjectAnnotationAttributes;
  159. /* Annotation attribute bits */
  160.  
  161. enum {
  162.     kTextObjAnnotationChangedMask = 0x01,
  163.     kTextObjTextChangedMask        = 0x02
  164. };
  165.  
  166. extern OSStatus AnnotateTextObject(TextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObjectAnnotationTag annotationType, ByteCount dataLength, const void *data, TextObjectAnnotationAttributes annotationOptions);
  167.  
  168. extern OSStatus DeleteTextObjectAnnotations(TextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObjectAnnotationTag annotationType);
  169.  
  170. /* Accessing annotations */
  171. struct TextObjectAnnotationInfo {
  172.     TextObjectAnnotationTag         annotationType;
  173.     TextObjectIndex                 rangeStart;
  174.     TextObjectIndex                 rangeEnd;
  175.     TextObjectAnnotationAttributes     attributes;
  176.     ByteCount                         dataSize;
  177.     const void *                    data;
  178. };
  179. typedef struct TextObjectAnnotationInfo TextObjectAnnotationInfo;
  180.  
  181. extern OSStatus CountTextObjectAnnotations(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObjectAnnotationTag annotationType, ItemCount *numAnnotations);
  182.  
  183. extern OSStatus GetTextObjectAnnotations(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObjectAnnotationTag annotationType, ItemCount infoArraySize, TextObjectAnnotationInfo annotationInfo[], ItemCount *actualNumAnnotations);
  184.  
  185. extern OSStatus SetAnnotationAttributes(TextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObjectAnnotationTag annotationType, TextObjectAnnotationAttributes annotationOptions);
  186.  
  187. /* Miscellaneous */
  188. extern OSStatus VerifyTextObject(ConstTextObject textObject);
  189.  
  190. extern OSStatus NormalizeTextObject(TextObject textObject);
  191.  
  192. #endif
  193.  
  194. #if PRAGMA_ALIGN_SUPPORTED
  195. #pragma options align=reset
  196. #endif
  197.  
  198. #if PRAGMA_IMPORT_SUPPORTED
  199. #pragma import off
  200. #endif
  201.  
  202. #ifdef __cplusplus
  203. }
  204. #endif
  205.  
  206. #endif /* __TEXTOBJECTS__ */
  207.  
  208.